package com.xros.demo.fileserver.domain.vo;

import lombok.Data;

import java.io.Serializable;

/**
 * @Author: mzp
 * @Description: 结果vo
 * @Date: 2024/3/27 11:33
 * @Version: 1.0
 */
@Data
public class ResultVo<T> implements Serializable {

    private Integer code;

    private String msg;

    private T data;




    private ResultVo(){

    }


    public static <R> ResultVo<R> create(String msg,Integer code,R data){
        ResultVo<R> res = new ResultVo<>();
        res.setCode(code);
        res.setData(data);
        res.setMsg(msg);
        return res;
    }


    public static <T>  ResultVo<T> builder(){
        return new ResultVo<>();
    }



    public  ResultVo<T> code(Integer code){
        this.code = code;
        return this;
    }

    public ResultVo<T> msg(String msg){
        this.msg = msg;
        return this;
    }

}
